﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HZ.BidSystem.IBLL;
using HZ.BidSystem.Model;
using System.Data;
namespace HZ.BidSystem.BLL
{
    public class BLL_Common : IBLL_Common
    {


        IList<HZ.BidSystem.Model.Project> IBLL_Common.GetProjectList()
        {
            return DAL.DAL_Project.GetProjectList();
        }

        HZ.BidSystem.Model.Project IBLL_Common.GetProjectInfoById(int ProjectId)
        {
            return HZ.Data.DAL_Helper.GetModelByID<Project>(new Project() { ProjectId = ProjectId });
        }

        HZ.BidSystem.Model.ProjectConfig IBLL_Common.GetProjectConfigById(int projectid)
        {
            return DAL.DAL_Project.GetProjectConfigById(projectid);
        }

        int IBLL_Common.Login(string username, string password, out HZ.BidSystem.Model.Account account)
        {
            return DAL.DAL_Account.Login(username, password, out account);
        }

        int IBLL_Common.SinglePointLogin(string username, out Account account)
        {
            return DAL.DAL_Account.Login(username, out account);
        }

        HZ.BidSystem.Model.Company IBLL_Common.GetCompanyById(int companyid)
        {
            return HZ.Data.DAL_Helper.GetModelByID<Company>(new Company() { CompanyId = companyid });
        }
        /// <summary>
        /// 判断是够存在议价品种
        /// </summary>
        /// <param name="companyid"></param>
        /// <returns></returns>
        int IBLL_Common.GetBargain(int companyid)
        {
            return DAL.DAL_Company.GetBargain(companyid);
        }
        /// <summary>
        /// 判断是够存在议价品种
        /// </summary>
        /// <param name="companyid"></param>
        /// <returns></returns>
        int IBLL_Common.GetGoodsBargain(int companyid)
        {
            return DAL.DAL_Company.GetGoodsBargain(companyid);
        }

        #region IBLL_Common Members


        private static object lockhelper = new object();
        int IBLL_Common.ChangePassword(int AccountId, string oldpassword, string newpassword)
        {
            lock (lockhelper)
            {

                return DAL.DAL_Account.ChangePassword(AccountId, oldpassword, newpassword);

            }
        }

        #endregion

        #region IBLL_Common Members


        int IBLL_Common.GetAllCompnayCount()
        {
            return DAL.DAL_BidStatus.GetAllCompnayCount();
        }

        int IBLL_Common.GetBidCompanyCount()
        {
            return DAL.DAL_BidStatus.GetBidCompanyCount();
        }

        int IBLL_Common.GetConfirmedCompanyCount()
        {
            return DAL.DAL_BidStatus.GetConfirmedCompanyCount();
        }

        /// <summary>
        /// 获取报价汇总统计
        /// </summary>
        /// <returns></returns>
        DataTable IBLL_Common.GetBidCount()
        {
            return DAL.DAL_BidStatus.GetBidCount();
        }

          /// <summary>
        /// 获取解密汇总统计
        /// </summary>
        /// <returns></returns>
        DataTable IBLL_Common.GetDecCount()
        {
            return DAL.DAL_BidStatus.GetDecCount();
        }
        #endregion

        #region IBLL_Common Members


        int IBLL_Common.GetAllGoodsCount(int projectid)
        {
            return DAL.DAL_Project_Bid.GetAllGoodsCount(projectid);
        }

        int IBLL_Common.GetBidGoodsCount(int projectid)
        {
            return DAL.DAL_Project_Bid.GetBidGoodsCount(projectid);
        }





        #endregion
    }
}
